package com.gduf.gulimall.search.controller;

import com.gduf.common.to.es.SkuEsModel;
import com.gduf.common.utils.R;
import com.gduf.gulimall.search.service.ProductSaveService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/search/save")
public class ElasticSaveController {

    @Resource
    private ProductSaveService productSaveService;

    //上架商品
    @PostMapping("/product")
    public R productStatusUp(List<SkuEsModel> skuEsModels)  {
        try {
            boolean b = productSaveService.productStatusUp(skuEsModels);
        } catch (IOException e) {
            e.printStackTrace();

            return R.error();
        }
        return R.ok();
    }

}
